<f:subview xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html"
  xmlns:c="http://java.sun.com/jstl/core" xmlns:ui="http://java.sun.com/jsf/facelets"
  xmlns:f="http://java.sun.com/jsf/core" xmlns:nxd="http://nuxeo.org/nxweb/document">

  <c:if test="#{connectBannerEnabled}">
    <c:choose>
      <c:when test="#{connectUpdateStatusInfo.registered}">

        <c:if test="false"> Instance is registered, but we can not check the status from the server side </c:if>

        <c:if test="#{currentNuxeoPrincipal!=null and currentNuxeoPrincipal.isAdministrator()}">
          <div style="display: none" id="connectExpiredMessageBanner">
            <div class="bannerBottom unregistered">
              <p class="register-instance">
                <h:outputText value=" #{messages['label.nuxeo.connect.footer.validation']}" />
              </p>
              <nxd:restDocumentLink view="#{mainTabsActions.getViewFor('admin')}" styleClass="button" addTabInfo="false"
                document="#{mainTabsActions.getDocumentFor('admin')}"
                tabs="MAIN_TABS:admin,NUXEO_ADMIN:ConnectClient:ConnectClientStatus">
                <h:outputText value=" #{messages['label.nuxeo.connect.footer.reactivate']}" />
              </nxd:restDocumentLink>
              <p class="nx-version">
                <h:outputText
                  value="#{messages['label.nuxeo.connect.footer.version']} #{connectUpdateStatusInfo.distributionVersion}" />
                <span class="hf-account" id="connectHotFixesCountMsg" style="display: none"> <a
                    target="marketplace"
                    href="#{nuxeoConnectUrl}marketplace/hotfixes/#{connectUpdateStatusInfo.distributionLabel}">
                    <span id="connectHotFixesCount">3</span>
                    <h:outputText value=" #{messages['label.nuxeo.connect.footer.instance.hf.account']}" />
                  </a>
                </span>
              </p>
            </div>
          </div>

          <h:outputScript target="#{pageJsTarget}">
              jQuery(document).ready(function() {
                var script = document.createElement('script');
                script.type = 'text/javascript';
                script.src = '#{connectUpdateStatusInfo.feedUrl}';
                jQuery("body").append(script);
              });
              function displayConnectUpdateStatus(registrationStatus) {
                if (registrationStatus.registered != true) {
                  jQuery(document).ready(
                      function() {
                        if (registrationStatus.nbPkgs &gt; 0) {
                          jQuery("#connectHotFixesCount").html(
                              "" + registrationStatus.nbPkgs);
                          jQuery("#connectHotFixesCountMsg").css(
                              "display", "block");
                        }
                        jQuery("#connectExpiredMessageBanner").css(
                            "display", "block");
                      });
                }
              }
          </h:outputScript>
        </c:if>

      </c:when>
      <c:otherwise>
        <c:if test="false"> Instance is not registered </c:if>

        <div class="bannerBottom unregistered">
          <p class="register">
            <h:outputText value="#{messages['label.nuxeo.connect.footer.instance.status']}" />
          </p>
          <ul>
            <li><h:graphicImage width="16px" height="16px" value="/img/nxconnect_studio.png" /> <h:outputText
                styleClass="nxconnectStudio" value="#{messages['label.nuxeo.connect.onlineRegistrationDescription']}" />
            </li>
            <li><h:graphicImage width="16px" height="16px" value="/img/nxconnect_maintenance.png" /> <h:outputText
                styleClass="nxconnectMaintenance"
                value="#{messages['label.nuxeo.connect.onlineRegistrationDescription2']}" /></li>
            <li><h:graphicImage width="16px" height="16px" value="/img/nxconnect_connect.png" /> <h:outputText
                styleClass="nxconnectInstance" value="#{messages['label.nuxeo.connect.onlineRegistrationDescription3']}" />
            </li>
          </ul>
          <a href="https://connect.nuxeo.com/register/#/&#38;product=#{connectUpdateStatusInfo.distributionLabel}"
            target="_blank" class="button">
            <h:outputText value=" #{messages['label.nuxeo.connect.footer.subscribe']}" />
          </a>
          <p class="register-instance">
            <h:outputText value="#{messages['label.nuxeo.connect.footer.instance.invitation']}" />
            <nxd:restDocumentLink view="#{mainTabsActions.getViewFor('admin')}" addTabInfo="false"
              document="#{mainTabsActions.getDocumentFor('admin')}"
              tabs="MAIN_TABS:admin,NUXEO_ADMIN:ConnectClient:ConnectClientStatus">
              <h:outputText value=" #{messages['label.nuxeo.connect.footer.helper']}" />
            </nxd:restDocumentLink>
          </p>
          <p class="nx-version">
            <h:outputText
              value="#{messages['label.nuxeo.connect.footer.version']} #{connectUpdateStatusInfo.distributionVersion}" />
            <span class="hf-account" id="connectHotFixesCountMsg" style="display: none"> <a target="marketplace"
                href="#{nuxeoConnectUrl}marketplace/hotfixes/#{connectUpdateStatusInfo.distributionLabel}">
                <span id="connectHotFixesCount">3</span>
                <h:outputText value=" #{messages['label.nuxeo.connect.footer.instance.hf.account']}" />
              </a>
            </span>
          </p>
        </div>

        <h:outputScript target="#{pageJsTarget}">
            jQuery(document).ready(function() {
              var script = document.createElement('script');
              script.type = 'text/javascript';
              script.src = '#{connectUpdateStatusInfo.feedUrl}';
              jQuery("body").append(script);
            });
            function displayConnectUpdateStatus(nbPkg) {
              jQuery(document).ready(
                  function() {
                    if (nbPkg &gt; 0) {
                      jQuery("#connectHotFixesCount").html("" + nbPkg);
                      jQuery("#connectHotFixesCountMsg").css("display",
                          "block");
                    }
                  });
            }
        </h:outputScript>

      </c:otherwise>

    </c:choose>
  </c:if>

</f:subview>
